#region Using Statements
using System;
using GameUpTableProject.Languages;
using GameUpTableProject.LoginScreens;
using WaveEngine.Common;
using WaveEngine.Common.Graphics;
using WaveEngine.Framework;
using WaveEngine.Framework.Services;
using WaveEngine.Components;
#endregion

namespace GameUpTableProject
{
    public class Game : WaveEngine.Framework.Game
    {
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            WaveServices.ViewportManager.Activate(1280, 720, ViewportManager.StretchMode.Uniform);

            ScreenContext screenContext = new ScreenContext(new InitialScene());
            WaveServices.ScreenContextManager.To(screenContext);
        }

        public static void LoadLanguage(string codeLanguage)
        {
            var language = "en";
            var langFilePath = string.Format("Content/Languages/{0}.xml", language);

            LanguageStrings langStrings;
            if (WaveServices.Storage.ExistsContentFile(langFilePath))
            {
                langStrings = WaveServices.Storage.ReadFromContent<LanguageStrings>(langFilePath);
            }
            else
            {
                // Load default language (english)
                langStrings = WaveServices.Storage.ReadFromContent<LanguageStrings>("Content/Languages/en.xml");
            }
            Catalog.RegisterItem(langStrings);
        }
    }
}
